home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 March / maximum-cd-2000-03.iso / Quake3 Game Source / Q3AGameSource.exe / Main / cg_local.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  34.9 KB  |  1,217 lines

  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3. #include "../game/q_shared.h"
  4. #include "tr_types.h"
  5. #include "../game/bg_public.h"
  6. #include "cg_public.h"
  7.  
  8. // The entire cgame module is unloaded and reloaded on each level change,
  9. // so there is NO persistant data between levels on the client side.
  10. // If you absolutely need something stored, it can either be kept
  11. // by the server in the server stored userinfos, or stashed in a cvar.
  12.  
  13.  
  14. #define    POWERUP_BLINKS        5
  15.  
  16. #define    POWERUP_BLINK_TIME    1000
  17. #define    FADE_TIME            200
  18. #define    PULSE_TIME            200
  19. #define    DAMAGE_DEFLECT_TIME    100
  20. #define    DAMAGE_RETURN_TIME    400
  21. #define DAMAGE_TIME            500
  22. #define    LAND_DEFLECT_TIME    150
  23. #define    LAND_RETURN_TIME    300
  24. #define    STEP_TIME            200
  25. #define    DUCK_TIME            100
  26. #define    PAIN_TWITCH_TIME    200
  27. #define    WEAPON_SELECT_TIME    1400
  28. #define    ITEM_SCALEUP_TIME    1000
  29. #define    ZOOM_TIME            150
  30. #define    ITEM_BLOB_TIME        200
  31. #define    MUZZLE_FLASH_TIME    20
  32. #define    SINK_TIME            1000        // time for fragments to sink into ground before going away
  33. #define    ATTACKER_HEAD_TIME    10000
  34. #define    REWARD_TIME            3000
  35.  
  36. #define    PULSE_SCALE            1.5            // amount to scale up the icons when activating
  37.  
  38. #define    MAX_STEP_CHANGE        32
  39.  
  40. #define    MAX_VERTS_ON_POLY    10
  41. #define    MAX_MARK_POLYS        256
  42.  
  43. #define STAT_MINUS            10    // num frame for '-' stats digit
  44.  
  45. #define    ICON_SIZE            48
  46. #define    CHAR_WIDTH            32
  47. #define    CHAR_HEIGHT            48
  48. #define    TEXT_ICON_SPACE        4
  49.  
  50. #define    TEAMCHAT_WIDTH        80
  51. #define TEAMCHAT_HEIGHT        8
  52.  
  53. // very large characters
  54. #define    GIANT_WIDTH            32
  55. #define    GIANT_HEIGHT        48
  56.  
  57. #define    NUM_CROSSHAIRS        10
  58.  
  59. #define    DEFAULT_MODEL        "sarge"
  60.  
  61. typedef enum {
  62.     FOOTSTEP_NORMAL,
  63.     FOOTSTEP_BOOT,
  64.     FOOTSTEP_FLESH,
  65.     FOOTSTEP_MECH,
  66.     FOOTSTEP_ENERGY,
  67.     FOOTSTEP_METAL,
  68.     FOOTSTEP_SPLASH,
  69.  
  70.     FOOTSTEP_TOTAL
  71. } footstep_t;
  72.  
  73.  
  74. //=================================================
  75.  
  76. // player entities need to track more information
  77. // than any other type of entity.
  78.  
  79. // note that not every player entity is a client entity,
  80. // because corpses after respawn are outside the normal
  81. // client numbering range
  82.  
  83. // when changing animation, set animationTime to frameTime + lerping time
  84. // The current lerp will finish out, then it will lerp to the new animation
  85. typedef struct {
  86.     int            oldFrame;
  87.     int            oldFrameTime;        // time when ->oldFrame was exactly on
  88.  
  89.     int            frame;
  90.     int            frameTime;            // time when ->frame will be exactly on
  91.  
  92.     float        backlerp;
  93.  
  94.     float        yawAngle;
  95.     qboolean    yawing;
  96.     float        pitchAngle;
  97.     qboolean    pitching;
  98.  
  99.     int            animationNumber;    // may include ANIM_TOGGLEBIT
  100.     animation_t    *animation;
  101.     int            animationTime;        // time when the first frame of the animation will be exact
  102. } lerpFrame_t;
  103.  
  104.  
  105. typedef struct {
  106.     lerpFrame_t        legs, torso;
  107.     int                painTime;
  108.     int                painDirection;    // flip from 0 to 1
  109.     int                lightningFiring;
  110.  
  111.     // railgun trail spawning
  112.     vec3_t            railgunImpact;
  113.     qboolean        railgunFlash;
  114.  
  115.     // machinegun spinning
  116.     float            barrelAngle;
  117.     int                barrelTime;
  118.     qboolean        barrelSpinning;
  119. } playerEntity_t;
  120.  
  121. //=================================================
  122.  
  123.  
  124.  
  125. // centity_t have a direct corespondence with gentity_t in the game, but
  126. // only the entityState_t is directly communicated to the cgame
  127. typedef struct centity_s {
  128.     entityState_t    currentState;    // from cg.frame
  129.     entityState_t    nextState;        // from cg.nextFrame, if available
  130.     qboolean        interpolate;    // true if next is valid to interpolate to
  131.     qboolean        currentValid;    // true if cg.frame holds this entity
  132.  
  133.     int                muzzleFlashTime;    // move to playerEntity?
  134.     int                previousEvent;
  135.     int                teleportFlag;
  136.  
  137.     int                trailTime;        // so missile trails can handle dropped initial packets
  138.     int                miscTime;
  139.  
  140.     playerEntity_t    pe;
  141.  
  142.     int                errorTime;        // decay the error from this time
  143.     vec3_t            errorOrigin;
  144.     vec3_t            errorAngles;
  145.     
  146.     qboolean        extrapolated;    // false if origin / angles is an interpolation
  147.     vec3_t            rawOrigin;
  148.     vec3_t            rawAngles;
  149.  
  150.     vec3_t            beamEnd;
  151.  
  152.     // exact interpolated position of entity on this frame
  153.     vec3_t            lerpOrigin;
  154.     vec3_t            lerpAngles;
  155. } centity_t;
  156.  
  157.  
  158. //======================================================================
  159.  
  160. // local entities are created as a result of events or predicted actions,
  161. // and live independantly from all server transmitted entities
  162.  
  163. typedef struct markPoly_s {
  164.     struct markPoly_s    *prevMark, *nextMark;
  165.     int            time;
  166.     qhandle_t    markShader;
  167.     qboolean    alphaFade;        // fade alpha instead of rgb
  168.     float        color[4];
  169.     poly_t        poly;
  170.     polyVert_t    verts[MAX_VERTS_ON_POLY];
  171. } markPoly_t;
  172.  
  173.  
  174. typedef enum {
  175.     LE_MARK,
  176.     LE_EXPLOSION,
  177.     LE_SPRITE_EXPLOSION,
  178.     LE_FRAGMENT,
  179.     LE_MOVE_SCALE_FADE,
  180.     LE_FALL_SCALE_FADE,
  181.     LE_FADE_RGB,
  182.     LE_SCALE_FADE
  183. } leType_t;
  184.  
  185. typedef enum {
  186.     LEF_PUFF_DONT_SCALE  = 0x0001,            // do not scale size over time
  187.     LEF_TUMBLE             = 0x0002            // tumble over time, used for ejecting shells
  188. } leFlag_t;
  189.  
  190. typedef enum {
  191.     LEMT_NONE,
  192.     LEMT_BLOOD
  193. } leMarkType_t;            // fragment local entities can leave marks on walls
  194.  
  195. typedef enum {
  196.     LEBS_NONE,
  197.     LEBS_BLOOD,
  198.     LEBS_BRASS
  199. } leBounceSoundType_t;    // fragment local entities can make sounds on impacts
  200.  
  201. typedef struct localEntity_s {
  202.     struct localEntity_s    *prev, *next;
  203.     leType_t        leType;
  204.     int                leFlags;
  205.  
  206.     int                startTime;
  207.     int                endTime;
  208.  
  209.     float            lifeRate;            // 1.0 / (endTime - startTime)
  210.  
  211.     trajectory_t    pos;
  212.     trajectory_t    angles;
  213.  
  214.     float            bounceFactor;        // 0.0 = no bounce, 1.0 = perfect
  215.  
  216.     float            color[4];
  217.  
  218.     float            radius;
  219.  
  220.     float            light;
  221.     vec3_t            lightColor;
  222.  
  223.     leMarkType_t        leMarkType;        // mark to leave on fragment impact
  224.     leBounceSoundType_t    leBounceSoundType;
  225.  
  226.     refEntity_t        refEntity;        
  227. } localEntity_t;
  228.  
  229. //======================================================================
  230.  
  231.  
  232. typedef struct {
  233.     int                client;
  234.     int                score;
  235.     int                ping;
  236.     int                time;
  237.     int                scoreFlags;
  238. } score_t;
  239.  
  240. // each client has an associated clientInfo_t
  241. // that contains media references necessary to present the
  242. // client model and other color coded effects
  243. // this is regenerated each time a client's configstring changes,
  244. // usually as a result of a userinfo (name, model, etc) change
  245. #define    MAX_CUSTOM_SOUNDS    32
  246. typedef struct {
  247.     qboolean        infoValid;
  248.  
  249.     char            name[MAX_QPATH];
  250.     team_t            team;
  251.  
  252.     int                botSkill;        // 0 = not bot, 1-5 = bot
  253.  
  254.     vec3_t            color;
  255.  
  256.     int                score;            // updated by score servercmds
  257.     int                location;        // location index for team mode
  258.     int                health;            // you only get this info about your teammates
  259.     int                armor;
  260.     int                curWeapon;
  261.  
  262.     int                handicap;
  263.     int                wins, losses;    // in tourney mode
  264.  
  265.     int                powerups;        // so can display quad/flag status
  266.  
  267.  
  268.     // when clientinfo is changed, the loading of models/skins/sounds
  269.     // can be deferred until you are dead, to prevent hitches in
  270.     // gameplay
  271.     char            modelName[MAX_QPATH];
  272.     char            skinName[MAX_QPATH];
  273.     qboolean        deferred;
  274.  
  275.     vec3_t            headOffset;        // move head in icon views
  276.     footstep_t        footsteps;
  277.     gender_t        gender;            // from model
  278.  
  279.     qhandle_t        legsModel;
  280.     qhandle_t        legsSkin;
  281.  
  282.     qhandle_t        torsoModel;
  283.     qhandle_t        torsoSkin;
  284.  
  285.     qhandle_t        headModel;
  286.     qhandle_t        headSkin;
  287.  
  288.     qhandle_t        modelIcon;
  289.  
  290.     animation_t        animations[MAX_ANIMATIONS];
  291.  
  292.     sfxHandle_t        sounds[MAX_CUSTOM_SOUNDS];
  293. } clientInfo_t;
  294.  
  295.  
  296. // each WP_* weapon enum has an associated weaponInfo_t
  297. // that contains media references necessary to present the
  298. // weapon and its effects
  299. typedef struct weaponInfo_s {
  300.     qboolean        registered;
  301.     gitem_t            *item;
  302.  
  303.     qhandle_t        handsModel;            // the hands don't actually draw, they just position the weapon
  304.     qhandle_t        weaponModel;
  305.     qhandle_t        barrelModel;
  306.     qhandle_t        flashModel;
  307.  
  308.     vec3_t            weaponMidpoint;        // so it will rotate centered instead of by tag
  309.  
  310.     float            flashDlight;
  311.     vec3_t            flashDlightColor;
  312.     sfxHandle_t        flashSound[4];        // fast firing weapons randomly choose
  313.  
  314.     qhandle_t        weaponIcon;
  315.     qhandle_t        ammoIcon;
  316.  
  317.     qhandle_t        ammoModel;
  318.  
  319.     qhandle_t        missileModel;
  320.     sfxHandle_t        missileSound;
  321.     void            (*missileTrailFunc)( centity_t *, const struct weaponInfo_s *wi );
  322.     float            missileDlight;
  323.     vec3_t            missileDlightColor;
  324.     int                missileRenderfx;
  325.  
  326.     void            (*ejectBrassFunc)( centity_t * );
  327.  
  328.     float            trailRadius;
  329.     float            wiTrailTime;
  330.  
  331.     sfxHandle_t        readySound;
  332.     sfxHandle_t        firingSound;
  333. } weaponInfo_t;
  334.  
  335.  
  336. // each IT_* item has an associated itemInfo_t
  337. // that constains media references necessary to present the
  338. // item and its effects
  339. typedef struct {
  340.     qboolean        registered;
  341.     qhandle_t        models[MAX_ITEM_MODELS];
  342.     qhandle_t        icon;
  343. } itemInfo_t;
  344.  
  345.  
  346. typedef struct {
  347.     int                itemNum;
  348. } powerupInfo_t;
  349.  
  350.  
  351. //======================================================================
  352.  
  353. // all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action
  354. // occurs, and they will have visible effects for #define STEP_TIME or whatever msec after
  355.  
  356. typedef struct {
  357.     int            clientFrame;        // incremented each frame
  358.     
  359.     qboolean    demoPlayback;
  360.     qboolean    levelShot;            // taking a level menu screenshot
  361.     int            deferredPlayerLoading;
  362.     qboolean    loading;            // don't defer players at initial startup
  363.     qboolean    intermissionStarted;    // don't play voice rewards, because game will end shortly
  364.  
  365.     // there are only one or two snapshot_t that are relevent at a time
  366.     int            latestSnapshotNum;    // the number of snapshots the client system has received
  367.     int            latestSnapshotTime;    // the time from latestSnapshotNum, so we don't need to read the snapshot yet
  368.  
  369.     snapshot_t    *snap;                // cg.snap->serverTime <= cg.time
  370.     snapshot_t    *nextSnap;            // cg.nextSnap->serverTime > cg.time, or NULL
  371.     snapshot_t    activeSnapshots[2];
  372.  
  373.     float        frameInterpolation;    // (float)( cg.time - cg.frame->serverTime ) / (cg.nextFrame->serverTime - cg.frame->serverTime)
  374.  
  375.     qboolean    thisFrameTeleport;
  376.     qboolean    nextFrameTeleport;
  377.  
  378.     int            frametime;        // cg.time - cg.oldTime
  379.  
  380.     int            time;            // this is the time value that the client
  381.                                 // is rendering at.
  382.     int            oldTime;        // time at last frame, used for missile trails and prediction checking
  383.  
  384.     int            physicsTime;    // either cg.snap->time or cg.nextSnap->time
  385.  
  386.     int            timelimitWarnings;    // 5 min, 1 min, overtime
  387.     int            fraglimitWarnings;
  388.  
  389.     qboolean    renderingThirdPerson;        // during deaths, chasecams, etc
  390.  
  391.     // prediction state
  392.     qboolean    hyperspace;                // true if prediction has hit a trigger_teleport
  393.     playerState_t    predictedPlayerState;
  394.     centity_t        predictedPlayerEntity;
  395.     qboolean    validPPS;                // clear until the first call to CG_PredictPlayerState
  396.     int            predictedErrorTime;
  397.     vec3_t        predictedError;
  398.  
  399.     float        stepChange;                // for stair up smoothing
  400.     int            stepTime;
  401.  
  402.     float        duckChange;                // for duck viewheight smoothing
  403.     int            duckTime;
  404.  
  405.     float        landChange;                // for landing hard
  406.     int            landTime;
  407.  
  408.     // input state sent to server
  409.     int            weaponSelect;
  410.  
  411.     // auto rotating items
  412.     vec3_t        autoAngles;
  413.     vec3_t        autoAxis[3];
  414.     vec3_t        autoAnglesFast;
  415.     vec3_t        autoAxisFast[3];
  416.  
  417.     // view rendering
  418.     refdef_t    refdef;
  419.     vec3_t        refdefViewAngles;        // will be converted to refdef.viewaxis
  420.  
  421.     // zoom key
  422.     qboolean    zoomed;
  423.     int            zoomTime;
  424.     float        zoomSensitivity;
  425.  
  426.     // information screen text during loading
  427.     char        infoScreenText[MAX_STRING_CHARS];
  428.  
  429.     // scoreboard
  430.     int            scoresRequestTime;
  431.     int            numScores;
  432.     int            teamScores[2];
  433.     score_t        scores[MAX_CLIENTS];
  434.     qboolean    showScores;
  435.     int            scoreFadeTime;
  436.     char        killerName[MAX_NAME_LENGTH];
  437.  
  438.     // centerprinting
  439.     int            centerPrintTime;
  440.     int            centerPrintCharWidth;
  441.     int            centerPrintY;
  442.     char        centerPrint[1024];
  443.     int            centerPrintLines;
  444.  
  445.     // low ammo warning state
  446.     int            lowAmmoWarning;        // 1 = low, 2 = empty
  447.  
  448.     // kill timers for carnage reward
  449.     int            lastKillTime;
  450.  
  451.     // crosshair client ID
  452.     int            crosshairClientNum;
  453.     int            crosshairClientTime;
  454.  
  455.     // powerup active flashing
  456.     int            powerupActive;
  457.     int            powerupTime;
  458.  
  459.     // attacking player
  460.     int            attackerTime;
  461.  
  462.     // reward medals
  463.     int            rewardTime;
  464.     int            rewardCount;
  465.     qhandle_t    rewardShader;
  466.  
  467.     // warmup countdown
  468.     int            warmup;
  469.     int            warmupCount;
  470.  
  471.     //==========================
  472.  
  473.     int            itemPickup;
  474.     int            itemPickupTime;
  475.     int            itemPickupBlendTime;    // the pulse around the crosshair is timed seperately
  476.  
  477.     int            weaponSelectTime;
  478.     int            weaponAnimation;
  479.     int            weaponAnimationTime;
  480.  
  481.     // blend blobs
  482.     float        damageTime;
  483.     float        damageX, damageY, damageValue;
  484.  
  485.     // status bar head
  486.     float        headYaw;
  487.     float        headEndPitch;
  488.     float        headEndYaw;
  489.     int            headEndTime;
  490.     float        headStartPitch;
  491.     float        headStartYaw;
  492.     int            headStartTime;
  493.  
  494.     // view movement
  495.     float        v_dmg_time;
  496.     float        v_dmg_pitch;
  497.     float        v_dmg_roll;
  498.  
  499.     vec3_t        kick_angles;    // weapon kicks
  500.     vec3_t        kick_origin;
  501.  
  502.     // temp working variables for player view
  503.     float        bobfracsin;
  504.     int            bobcycle;
  505.     float        xyspeed;
  506.  
  507.     // development tool
  508.     refEntity_t        testModelEntity;
  509.     char            testModelName[MAX_QPATH];
  510.     qboolean        testGun;
  511.  
  512. } cg_t;
  513.  
  514.  
  515. // all of the model, shader, and sound references that are
  516. // loaded at gamestate time are stored in cgMedia_t
  517. // Other media that can be tied to clients, weapons, or items are
  518. // stored in the clientInfo_t, itemInfo_t, weaponInfo_t, and powerupInfo_t
  519. typedef struct {
  520.     qhandle_t    charsetShader;
  521.     qhandle_t    charsetProp;
  522.     qhandle_t    charsetPropGlow;
  523.     qhandle_t    charsetPropB;
  524.     qhandle_t    whiteShader;
  525.  
  526.     qhandle_t    redFlagModel;
  527.     qhandle_t    blueFlagModel;
  528.     qhandle_t    redFlagShader[3];
  529.     qhandle_t    blueFlagShader[3];
  530.  
  531.     qhandle_t    armorModel;
  532.     qhandle_t    armorIcon;
  533.  
  534.     qhandle_t    teamStatusBar;
  535.  
  536.     qhandle_t    deferShader;
  537.  
  538.     // gib explosions
  539.     qhandle_t    gibAbdomen;
  540.     qhandle_t    gibArm;
  541.     qhandle_t    gibChest;
  542.     qhandle_t    gibFist;
  543.     qhandle_t    gibFoot;
  544.     qhandle_t    gibForearm;
  545.     qhandle_t    gibIntestine;
  546.     qhandle_t    gibLeg;
  547.     qhandle_t    gibSkull;
  548.     qhandle_t    gibBrain;
  549.  
  550.     qhandle_t    machinegunBrassModel;
  551.     qhandle_t    shotgunBrassModel;
  552.  
  553.     qhandle_t    railRingsShader;
  554.     qhandle_t    railCoreShader;
  555.  
  556.     qhandle_t    lightningShader;
  557.  
  558.     qhandle_t    friendShader;
  559.  
  560.     qhandle_t    balloonShader;
  561.     qhandle_t    connectionShader;
  562.  
  563.     qhandle_t    selectShader;
  564.     qhandle_t    viewBloodShader;
  565.     qhandle_t    tracerShader;
  566.     qhandle_t    crosshairShader[NUM_CROSSHAIRS];
  567.     qhandle_t    lagometerShader;
  568.     qhandle_t    backTileShader;
  569.     qhandle_t    noammoShader;
  570.  
  571.     qhandle_t    smokePuffShader;
  572.     qhandle_t    smokePuffRageProShader;
  573.     qhandle_t    shotgunSmokePuffShader;
  574.     qhandle_t    plasmaBallShader;
  575.     qhandle_t    waterBubbleShader;
  576.     qhandle_t    bloodTrailShader;
  577.  
  578.     qhandle_t    numberShaders[11];
  579.  
  580.     qhandle_t    shadowMarkShader;
  581.  
  582.     qhandle_t    botSkillShaders[5];
  583.  
  584.     // wall mark shaders
  585.     qhandle_t    wakeMarkShader;
  586.     qhandle_t    bloodMarkShader;
  587.     qhandle_t    bulletMarkShader;
  588.     qhandle_t    burnMarkShader;
  589.     qhandle_t    holeMarkShader;
  590.     qhandle_t    energyMarkShader;
  591.  
  592.     // powerup shaders
  593.     qhandle_t    quadShader;
  594.     qhandle_t    redQuadShader;
  595.     qhandle_t    quadWeaponShader;
  596.     qhandle_t    invisShader;
  597.     qhandle_t    regenShader;
  598.     qhandle_t    battleSuitShader;
  599.     qhandle_t    battleWeaponShader;
  600.     qhandle_t    hastePuffShader;
  601.  
  602.     // weapon effect models
  603.     qhandle_t    bulletFlashModel;
  604.     qhandle_t    ringFlashModel;
  605.     qhandle_t    dishFlashModel;
  606.     qhandle_t    lightningExplosionModel;
  607.  
  608.     // weapon effect shaders
  609.     qhandle_t    railExplosionShader;
  610.     qhandle_t    plasmaExplosionShader;
  611.     qhandle_t    bulletExplosionShader;
  612.     qhandle_t    rocketExplosionShader;
  613.     qhandle_t    grenadeExplosionShader;
  614.     qhandle_t    bfgExplosionShader;
  615.     qhandle_t    bloodExplosionShader;
  616.  
  617.     // special effects models
  618.     qhandle_t    teleportEffectModel;
  619.     qhandle_t    teleportEffectShader;
  620.  
  621.     // scoreboard headers
  622.     qhandle_t    scoreboardName;
  623.     qhandle_t    scoreboardPing;
  624.     qhandle_t    scoreboardScore;
  625.     qhandle_t    scoreboardTime;
  626.  
  627.     // medals shown during gameplay
  628.     qhandle_t    medalImpressive;
  629.     qhandle_t    medalExcellent;
  630.     qhandle_t    medalGauntlet;
  631.  
  632.     // sounds
  633.     sfxHandle_t    quadSound;
  634.     sfxHandle_t    tracerSound;
  635.     sfxHandle_t    selectSound;
  636.     sfxHandle_t    useNothingSound;
  637.     sfxHandle_t    wearOffSound;
  638.     sfxHandle_t    footsteps[FOOTSTEP_TOTAL][4];
  639.     sfxHandle_t    sfx_lghit1;
  640.     sfxHandle_t    sfx_lghit2;
  641.     sfxHandle_t    sfx_lghit3;
  642.     sfxHandle_t    sfx_ric1;
  643.     sfxHandle_t    sfx_ric2;
  644.     sfxHandle_t    sfx_ric3;
  645.     sfxHandle_t    sfx_railg;
  646.     sfxHandle_t    sfx_rockexp;
  647.     sfxHandle_t    sfx_plasmaexp;
  648.     sfxHandle_t    gibSound;
  649.     sfxHandle_t    gibBounce1Sound;
  650.     sfxHandle_t    gibBounce2Sound;
  651.     sfxHandle_t    gibBounce3Sound;
  652.     sfxHandle_t    teleInSound;
  653.     sfxHandle_t    teleOutSound;
  654.     sfxHandle_t    noAmmoSound;
  655.     sfxHandle_t    respawnSound;
  656.     sfxHandle_t talkSound;
  657.     sfxHandle_t landSound;
  658.     sfxHandle_t fallSound;
  659.     sfxHandle_t jumpPadSound;
  660.  
  661.     sfxHandle_t oneMinuteSound;
  662.     sfxHandle_t fiveMinuteSound;
  663.     sfxHandle_t suddenDeathSound;
  664.  
  665.     sfxHandle_t threeFragSound;
  666.     sfxHandle_t twoFragSound;
  667.     sfxHandle_t oneFragSound;
  668.  
  669.     sfxHandle_t hitSound;
  670.     sfxHandle_t hitTeamSound;
  671.     sfxHandle_t impressiveSound;
  672.     sfxHandle_t excellentSound;
  673.     sfxHandle_t deniedSound;
  674.     sfxHandle_t humiliationSound;
  675.  
  676.     sfxHandle_t takenLeadSound;
  677.     sfxHandle_t tiedLeadSound;
  678.     sfxHandle_t lostLeadSound;
  679.  
  680.     sfxHandle_t watrInSound;
  681.     sfxHandle_t watrOutSound;
  682.     sfxHandle_t watrUnSound;
  683.  
  684.     sfxHandle_t flightSound;
  685.     sfxHandle_t medkitSound;
  686.  
  687.     // teamplay sounds
  688.     sfxHandle_t redLeadsSound;
  689.     sfxHandle_t blueLeadsSound;
  690.     sfxHandle_t teamsTiedSound;
  691.  
  692.     // tournament sounds
  693.     sfxHandle_t    count3Sound;
  694.     sfxHandle_t    count2Sound;
  695.     sfxHandle_t    count1Sound;
  696.     sfxHandle_t    countFightSound;
  697.     sfxHandle_t    countPrepareSound;
  698.  
  699. } cgMedia_t;
  700.  
  701.  
  702. // The client game static (cgs) structure hold everything
  703. // loaded or calculated from the gamestate.  It will NOT
  704. // be cleared when a tournement restart is done, allowing
  705. // all clients to begin playing instantly
  706. typedef struct {
  707.     gameState_t        gameState;            // gamestate from server
  708.     glconfig_t        glconfig;            // rendering configuration
  709.     float            screenXScale;        // derived from glconfig
  710.     float            screenYScale;
  711.     float            screenXBias;
  712.  
  713.     int                serverCommandSequence;    // reliable command stream counter
  714.     int                processedSnapshotNum;// the number of snapshots cgame has requested
  715.  
  716.     qboolean        localServer;        // detected on startup by checking sv_running
  717.  
  718.     // parsed from serverinfo
  719.     gametype_t        gametype;
  720.     int                dmflags;
  721.     int                teamflags;
  722.     int                fraglimit;
  723.     int                capturelimit;
  724.     int                timelimit;
  725.     int                maxclients;
  726.     char            mapname[MAX_QPATH];
  727.  
  728.     int                voteTime;
  729.     int                voteYes;
  730.     int                voteNo;
  731.     qboolean        voteModified;            // beep whenever changed
  732.     char            voteString[MAX_STRING_TOKENS];
  733.  
  734.     int                levelStartTime;
  735.  
  736.     int                scores1, scores2;        // from configstrings
  737.     int                redflag, blueflag;        // flag status from configstrings
  738.  
  739.     //
  740.     // locally derived information from gamestate
  741.     //
  742.     qhandle_t        gameModels[MAX_MODELS];
  743.     sfxHandle_t        gameSounds[MAX_SOUNDS];
  744.  
  745.     int                numInlineModels;
  746.     qhandle_t        inlineDrawModel[MAX_MODELS];
  747.     vec3_t            inlineModelMidpoints[MAX_MODELS];
  748.  
  749.     clientInfo_t    clientinfo[MAX_CLIENTS];
  750.  
  751.     // teamchat width is *3 because of embedded color codes
  752.     char            teamChatMsgs[TEAMCHAT_HEIGHT][TEAMCHAT_WIDTH*3+1];
  753.     int                teamChatMsgTimes[TEAMCHAT_HEIGHT];
  754.     int                teamChatPos;
  755.     int                teamLastChatPos;
  756.  
  757.     // media
  758.     cgMedia_t        media;
  759. } cgs_t;
  760.  
  761. //==============================================================================
  762.  
  763. extern    cgs_t            cgs;
  764. extern    cg_t            cg;
  765. extern    centity_t        cg_entities[MAX_GENTITIES];
  766. extern    weaponInfo_t    cg_weapons[MAX_WEAPONS];
  767. extern    itemInfo_t        cg_items[MAX_ITEMS];
  768. extern    markPoly_t        cg_markPolys[MAX_MARK_POLYS];
  769.  
  770. extern    vmCvar_t        cg_centertime;
  771. extern    vmCvar_t        cg_runpitch;
  772. extern    vmCvar_t        cg_runroll;
  773. extern    vmCvar_t        cg_bobup;
  774. extern    vmCvar_t        cg_bobpitch;
  775. extern    vmCvar_t        cg_bobroll;
  776. extern    vmCvar_t        cg_swingSpeed;
  777. extern    vmCvar_t        cg_shadows;
  778. extern    vmCvar_t        cg_gibs;
  779. extern    vmCvar_t        cg_drawTimer;
  780. extern    vmCvar_t        cg_drawFPS;
  781. extern    vmCvar_t        cg_drawSnapshot;
  782. extern    vmCvar_t        cg_draw3dIcons;
  783. extern    vmCvar_t        cg_drawIcons;
  784. extern    vmCvar_t        cg_drawAmmoWarning;
  785. extern    vmCvar_t        cg_drawCrosshair;
  786. extern    vmCvar_t        cg_drawCrosshairNames;
  787. extern    vmCvar_t        cg_drawRewards;
  788. extern    vmCvar_t        cg_drawTeamOverlay;
  789. extern    vmCvar_t        cg_teamOverlayUserinfo;
  790. extern    vmCvar_t        cg_crosshairX;
  791. extern    vmCvar_t        cg_crosshairY;
  792. extern    vmCvar_t        cg_crosshairSize;
  793. extern    vmCvar_t        cg_crosshairHealth;
  794. extern    vmCvar_t        cg_drawStatus;
  795. extern    vmCvar_t        cg_draw2D;
  796. extern    vmCvar_t        cg_animSpeed;
  797. extern    vmCvar_t        cg_debugAnim;
  798. extern    vmCvar_t        cg_debugPosition;
  799. extern    vmCvar_t        cg_debugEvents;
  800. extern    vmCvar_t        cg_railTrailTime;
  801. extern    vmCvar_t        cg_errorDecay;
  802. extern    vmCvar_t        cg_nopredict;
  803. extern    vmCvar_t        cg_noPlayerAnims;
  804. extern    vmCvar_t        cg_showmiss;
  805. extern    vmCvar_t        cg_footsteps;
  806. extern    vmCvar_t        cg_addMarks;
  807. extern    vmCvar_t        cg_brassTime;
  808. extern    vmCvar_t        cg_gun_frame;
  809. extern    vmCvar_t        cg_gun_x;
  810. extern    vmCvar_t        cg_gun_y;
  811. extern    vmCvar_t        cg_gun_z;
  812. extern    vmCvar_t        cg_drawGun;
  813. extern    vmCvar_t        cg_viewsize;
  814. extern    vmCvar_t        cg_tracerChance;
  815. extern    vmCvar_t        cg_tracerWidth;
  816. extern    vmCvar_t        cg_tracerLength;
  817. extern    vmCvar_t        cg_autoswitch;
  818. extern    vmCvar_t        cg_ignore;
  819. extern    vmCvar_t        cg_simpleItems;
  820. extern    vmCvar_t        cg_fov;
  821. extern    vmCvar_t        cg_zoomFov;
  822. extern    vmCvar_t        cg_thirdPersonRange;
  823. extern    vmCvar_t        cg_thirdPersonAngle;
  824. extern    vmCvar_t        cg_thirdPerson;
  825. extern    vmCvar_t        cg_stereoSeparation;
  826. extern    vmCvar_t        cg_lagometer;
  827. extern    vmCvar_t        cg_drawAttacker;
  828. extern    vmCvar_t        cg_syncronousClients;
  829. extern    vmCvar_t        cg_teamChatTime;
  830. extern    vmCvar_t        cg_teamChatHeight;
  831. extern    vmCvar_t        cg_stats;
  832. extern    vmCvar_t         cg_forceModel;
  833. extern    vmCvar_t         cg_buildScript;
  834. extern    vmCvar_t        cg_paused;
  835. extern    vmCvar_t        cg_blood;
  836. extern    vmCvar_t        cg_predictItems;
  837. extern    vmCvar_t        cg_deferPlayers;
  838.  
  839. //
  840. // cg_main.c
  841. //
  842. const char *CG_ConfigString( int index );
  843. const char *CG_Argv( int arg );
  844.  
  845. void QDECL CG_Printf( const char *msg, ... );
  846. void QDECL CG_Error( const char *msg, ... );
  847.  
  848. void CG_StartMusic( void );
  849.  
  850. void CG_UpdateCvars( void );
  851.  
  852. int CG_CrosshairPlayer( void );
  853. int CG_LastAttacker( void );
  854.  
  855.  
  856. //
  857. // cg_view.c
  858. //
  859. void CG_TestModel_f (void);
  860. void CG_TestGun_f (void);
  861. void CG_TestModelNextFrame_f (void);
  862. void CG_TestModelPrevFrame_f (void);
  863. void CG_TestModelNextSkin_f (void);
  864. void CG_TestModelPrevSkin_f (void);
  865. void CG_ZoomDown_f( void );
  866. void CG_ZoomUp_f( void );
  867.  
  868. void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
  869.  
  870.  
  871. //
  872. // cg_drawtools.c
  873. //
  874. void CG_AdjustFrom640( float *x, float *y, float *w, float *h );
  875. void CG_FillRect( float x, float y, float width, float height, const float *color );
  876. void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
  877. void CG_DrawString( float x, float y, const char *string, 
  878.                    float charWidth, float charHeight, const float *modulate );
  879.  
  880.  
  881. void CG_DrawStringExt( int x, int y, const char *string, const float *setColor, 
  882.         qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars );
  883. void CG_DrawBigString( int x, int y, const char *s, float alpha );
  884. void CG_DrawBigStringColor( int x, int y, const char *s, vec4_t color );
  885. void CG_DrawSmallString( int x, int y, const char *s, float alpha );
  886. void CG_DrawSmallStringColor( int x, int y, const char *s, vec4_t color );
  887.  
  888. int CG_DrawStrlen( const char *str );
  889.  
  890. float    *CG_FadeColor( int startMsec, int totalMsec );
  891. float *CG_TeamColor( int team );
  892. void CG_TileClear( void );
  893. void CG_ColorForHealth( vec4_t hcolor );
  894. void CG_GetColorForHealth( int health, int armor, vec4_t hcolor );
  895.  
  896. void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color );
  897.  
  898.  
  899. //
  900. // cg_draw.c
  901. //
  902. extern    int sortedTeamPlayers[TEAM_MAXOVERLAY];
  903. extern    int    numSortedTeamPlayers;
  904. extern    int drawTeamOverlayModificationCount;
  905.  
  906. void CG_AddLagometerFrameInfo( void );
  907. void CG_AddLagometerSnapshotInfo( snapshot_t *snap );
  908. void CG_CenterPrint( const char *str, int y, int charWidth );
  909. void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t headAngles );
  910. void CG_DrawActive( stereoFrame_t stereoView );
  911. void CG_DrawFlagModel( float x, float y, float w, float h, int team );
  912. void CG_DrawTeamBackground( int x, int y, int w, int h, float alpha, int team );
  913.  
  914.  
  915. //
  916. // cg_player.c
  917. //
  918. void CG_Player( centity_t *cent );
  919. void CG_ResetPlayerEntity( centity_t *cent );
  920. void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, int team );
  921. void CG_NewClientInfo( int clientNum );
  922. sfxHandle_t    CG_CustomSound( int clientNum, const char *soundName );
  923.  
  924. //
  925. // cg_predict.c
  926. //
  927. void CG_BuildSolidList( void );
  928. int    CG_PointContents( const vec3_t point, int passEntityNum );
  929. void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, 
  930.                      int skipNumber, int mask );
  931. void CG_PredictPlayerState( void );
  932. void CG_LoadDeferredPlayers( void );
  933.  
  934.  
  935. //
  936. // cg_events.c
  937. //
  938. void CG_CheckEvents( centity_t *cent );
  939. const char    *CG_PlaceString( int rank );
  940. void CG_EntityEvent( centity_t *cent, vec3_t position );
  941. void CG_PainEvent( centity_t *cent, int health );
  942.  
  943.  
  944. //
  945. // cg_ents.c
  946. //
  947. void CG_SetEntitySoundPosition( centity_t *cent );
  948. void CG_AddPacketEntities( void );
  949. void CG_Beam( centity_t *cent );
  950. void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out );
  951.  
  952. void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent, 
  953.                             qhandle_t parentModel, char *tagName );
  954. void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent, 
  955.                             qhandle_t parentModel, char *tagName );
  956.  
  957.  
  958.  
  959. //
  960. // cg_weapons.c
  961. //
  962. void CG_NextWeapon_f( void );
  963. void CG_PrevWeapon_f( void );
  964. void CG_Weapon_f( void );
  965.  
  966. void CG_RegisterWeapon( int weaponNum );
  967. void CG_RegisterItemVisuals( int itemNum );
  968.  
  969. void CG_FireWeapon( centity_t *cent );
  970. void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir );
  971. void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum );
  972. void CG_ShotgunFire( entityState_t *es );
  973. void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
  974.  
  975. void CG_RailTrail( clientInfo_t *ci, vec3_t start, vec3_t end );
  976. void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi );
  977. void CG_AddViewWeapon (playerState_t *ps);
  978. void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent );
  979. void CG_DrawWeaponSelect( void );
  980.  
  981. void CG_OutOfAmmoChange( void );    // should this be in pmove?
  982.  
  983. //
  984. // cg_marks.c
  985. //
  986. void    CG_InitMarkPolys( void );
  987. void    CG_AddMarks( void );
  988. void    CG_ImpactMark( qhandle_t markShader, 
  989.                     const vec3_t origin, const vec3_t dir, 
  990.                     float orientation, 
  991.                     float r, float g, float b, float a, 
  992.                     qboolean alphaFade, 
  993.                     float radius, qboolean temporary );
  994.  
  995. //
  996. // cg_localents.c
  997. //
  998. void    CG_InitLocalEntities( void );
  999. localEntity_t    *CG_AllocLocalEntity( void );
  1000. void    CG_AddLocalEntities( void );
  1001.  
  1002. //
  1003. // cg_effects.c
  1004. //
  1005. localEntity_t *CG_SmokePuff( const vec3_t p, 
  1006.                    const vec3_t vel, 
  1007.                    float radius,
  1008.                    float r, float g, float b, float a,
  1009.                    float duration,
  1010.                    int startTime,
  1011.                    int leFlags,
  1012.                    qhandle_t hShader );
  1013. void CG_BubbleTrail( vec3_t start, vec3_t end, float spacing );
  1014. void CG_SpawnEffect( vec3_t org );
  1015. void CG_GibPlayer( vec3_t playerOrigin );
  1016.  
  1017. void CG_Bleed( vec3_t origin, int entityNum );
  1018.  
  1019. localEntity_t *CG_MakeExplosion( vec3_t origin, vec3_t dir,
  1020.                                 qhandle_t hModel, qhandle_t shader, int msec,
  1021.                                 qboolean isSprite );
  1022.  
  1023. //
  1024. // cg_snapshot.c
  1025. //
  1026. void CG_ProcessSnapshots( void );
  1027.  
  1028. //
  1029. // cg_info.c
  1030. //
  1031. void CG_LoadingString( const char *s );
  1032. void CG_LoadingItem( int itemNum );
  1033. void CG_LoadingClient( int clientNum );
  1034. void CG_DrawInformation( void );
  1035.  
  1036. //
  1037. // cg_scoreboard.c
  1038. //
  1039. qboolean CG_DrawScoreboard( void );
  1040. void CG_DrawTourneyScoreboard( void );
  1041.  
  1042. //
  1043. // cg_consolecmds.c
  1044. //
  1045. qboolean CG_ConsoleCommand( void );
  1046. void CG_InitConsoleCommands( void );
  1047.  
  1048. //
  1049. // cg_servercmds.c
  1050. //
  1051. void CG_ExecuteNewServerCommands( int latestSequence );
  1052. void CG_ParseServerinfo( void );
  1053. void CG_SetConfigValues( void );
  1054.  
  1055. //
  1056. // cg_playerstate.c
  1057. //
  1058. void CG_Respawn( void );
  1059. void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops );
  1060.  
  1061.  
  1062. //===============================================
  1063.  
  1064. //
  1065. // system traps
  1066. // These functions are how the cgame communicates with the main game system
  1067. //
  1068.  
  1069. // print message on the local console
  1070. void        trap_Print( const char *fmt );
  1071.  
  1072. // abort the game
  1073. void        trap_Error( const char *fmt );
  1074.  
  1075. // milliseconds should only be used for performance tuning, never
  1076. // for anything game related.  Get time from the CG_DrawActiveFrame parameter
  1077. int            trap_Milliseconds( void );
  1078.  
  1079. // console variable interaction
  1080. void        trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
  1081. void        trap_Cvar_Update( vmCvar_t *vmCvar );
  1082. void        trap_Cvar_Set( const char *var_name, const char *value );
  1083. void        trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
  1084.  
  1085. // ServerCommand and ConsoleCommand parameter access
  1086. int            trap_Argc( void );
  1087. void        trap_Argv( int n, char *buffer, int bufferLength );
  1088. void        trap_Args( char *buffer, int bufferLength );
  1089.  
  1090. // filesystem access
  1091. // returns length of file
  1092. int            trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
  1093. void        trap_FS_Read( void *buffer, int len, fileHandle_t f );
  1094. void        trap_FS_Write( const void *buffer, int len, fileHandle_t f );
  1095. void        trap_FS_FCloseFile( fileHandle_t f );
  1096.  
  1097. // add commands to the local console as if they were typed in
  1098. // for map changing, etc.  The command is not executed immediately,
  1099. // but will be executed in order the next time console commands
  1100. // are processed
  1101. void        trap_SendConsoleCommand( const char *text );
  1102.  
  1103. // register a command name so the console can perform command completion.
  1104. // FIXME: replace this with a normal console command "defineCommand"?
  1105. void        trap_AddCommand( const char *cmdName );
  1106.  
  1107. // send a string to the server over the network
  1108. void        trap_SendClientCommand( const char *s );
  1109.  
  1110. // force a screen update, only used during gamestate load
  1111. void        trap_UpdateScreen( void );
  1112.  
  1113. // model collision
  1114. void        trap_CM_LoadMap( const char *mapname );
  1115. int            trap_CM_NumInlineModels( void );
  1116. clipHandle_t trap_CM_InlineModel( int index );        // 0 = world, 1+ = bmodels
  1117. clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs );
  1118. int            trap_CM_PointContents( const vec3_t p, clipHandle_t model );
  1119. int            trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles );
  1120. void        trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
  1121.                       const vec3_t mins, const vec3_t maxs,
  1122.                       clipHandle_t model, int brushmask );
  1123. void        trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
  1124.                       const vec3_t mins, const vec3_t maxs,
  1125.                       clipHandle_t model, int brushmask,
  1126.                       const vec3_t origin, const vec3_t angles );
  1127.  
  1128. // Returns the projection of a polygon onto the solid brushes in the world
  1129. int            trap_CM_MarkFragments( int numPoints, const vec3_t *points, 
  1130.             const vec3_t projection,
  1131.             int maxPoints, vec3_t pointBuffer,
  1132.             int maxFragments, markFragment_t *fragmentBuffer );
  1133.  
  1134. // normal sounds will have their volume dynamically changed as their entity
  1135. // moves and the listener moves
  1136. void        trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx );
  1137.  
  1138. // a local sound is always played full volume
  1139. void        trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
  1140. void        trap_S_ClearLoopingSounds( void );
  1141. void        trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
  1142. void        trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin );
  1143.  
  1144. // repatialize recalculates the volumes of sound as they should be heard by the
  1145. // given entityNum and position
  1146. void        trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
  1147. sfxHandle_t    trap_S_RegisterSound( const char *sample );        // returns buzz if not found
  1148. void        trap_S_StartBackgroundTrack( const char *intro, const char *loop );    // empty name stops music
  1149.  
  1150.  
  1151. void        trap_R_LoadWorldMap( const char *mapname );
  1152.  
  1153. // all media should be registered during level startup to prevent
  1154. // hitches during gameplay
  1155. qhandle_t    trap_R_RegisterModel( const char *name );            // returns rgb axis if not found
  1156. qhandle_t    trap_R_RegisterSkin( const char *name );            // returns all white if not found
  1157. qhandle_t    trap_R_RegisterShader( const char *name );            // returns all white if not found
  1158. qhandle_t    trap_R_RegisterShaderNoMip( const char *name );            // returns all white if not found
  1159.  
  1160. // a scene is built up by calls to R_ClearScene and the various R_Add functions.
  1161. // Nothing is drawn until R_RenderScene is called.
  1162. void        trap_R_ClearScene( void );
  1163. void        trap_R_AddRefEntityToScene( const refEntity_t *re );
  1164.  
  1165. // polys are intended for simple wall marks, not really for doing
  1166. // significant construction
  1167. void        trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
  1168. void        trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
  1169. void        trap_R_RenderScene( const refdef_t *fd );
  1170. void        trap_R_SetColor( const float *rgba );    // NULL = 1,1,1,1
  1171. void        trap_R_DrawStretchPic( float x, float y, float w, float h, 
  1172.             float s1, float t1, float s2, float t2, qhandle_t hShader );
  1173. void        trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
  1174. void        trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, 
  1175.                        float frac, const char *tagName );
  1176.  
  1177. // The glconfig_t will not change during the life of a cgame.
  1178. // If it needs to change, the entire cgame will be restarted, because
  1179. // all the qhandle_t are then invalid.
  1180. void        trap_GetGlconfig( glconfig_t *glconfig );
  1181.  
  1182. // the gamestate should be grabbed at startup, and whenever a
  1183. // configstring changes
  1184. void        trap_GetGameState( gameState_t *gamestate );
  1185.  
  1186. // cgame will poll each frame to see if a newer snapshot has arrived
  1187. // that it is interested in.  The time is returned seperately so that
  1188. // snapshot latency can be calculated.
  1189. void        trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime );
  1190.  
  1191. // a snapshot get can fail if the snapshot (or the entties it holds) is so
  1192. // old that it has fallen out of the client system queue
  1193. qboolean    trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot );
  1194.  
  1195. // retrieve a text command from the server stream
  1196. // the current snapshot will hold the number of the most recent command
  1197. // qfalse can be returned if the client system handled the command
  1198. // argc() / argv() can be used to examine the parameters of the command
  1199. qboolean    trap_GetServerCommand( int serverCommandNumber );
  1200.  
  1201. // returns the most recent command number that can be passed to GetUserCmd
  1202. // this will always be at least one higher than the number in the current
  1203. // snapshot, and it may be quite a few higher if it is a fast computer on
  1204. // a lagged connection
  1205. int            trap_GetCurrentCmdNumber( void );    
  1206.  
  1207. qboolean    trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd );
  1208.  
  1209. // used for the weapon select and zoom
  1210. void        trap_SetUserCmdValue( int stateValue, float sensitivityScale );
  1211.  
  1212. // aids for VM testing
  1213. void        testPrintInt( char *string, int i );
  1214. void        testPrintFloat( char *string, float f );
  1215.  
  1216. int            trap_MemoryRemaining( void );
  1217.